<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05_JS运算符</title>
</head>
<body>
<script>
    console.log(6/2);//3
    console.log(3/2);//1.5

    //比较运算符的结果是布尔值
    //如果比较运算符任意一侧有数字,会将非数字转为数字再进行比较
    console.log(3>10);//flase
    console.log(3>'10');//flase
    console.log('3'>10);//false

    //如果比较运算符两侧都是字符串,则比较的是字符串的字符的编码值

    //’33331‘.charCodeAt(4)获取指定下标出字符的编码,默认去第一个字符的编码
    console.log('超'>'宇');//true
    console.log('超'.charCodeAt());
    console.log('宇'.charCodeAt());
    console.log('3'>'10');
    console.log('1'.charCodeAt());//49
    console.log('100863'.charCodeAt());//49
    console.log('3'.charCodeAt());//51
    console.log('100863'.charCodeAt(5));//51

    let a = 1;
    let b = true;
    //松散比较运算符,只比较值1 == Number(true) true
    console.log(a == b);
    //严格比较运算符,先比较数据类型,类型一致了在比较值 number类型不等于布尔类型 false
    console.log(a === b);

    let c = 0;
    console.log(c == 0 ? 'YES' : 'NO');//YES
    // =是赋值符号,先把c的值赋值为0,然后转为布尔得到false,对于三元运算符来说,false取值”NO“
    console.log(c = 0 ? 'YES' : 'NO');




</script>
</body>
</html>